package com.多线程07.demo04;

public class MyThread extends Thread {

    @Override
    public void run() {
        for (int i=0;i<100;i++){
            System.out.println(i);
        }
        System.out.println("run方法内线程名字+Thread.currentThread().getName:"+Thread.currentThread().getName());
        System.out.println("run方法内线程名字+getName:"+getName());
    }


    public static void main(String[] args) {
        MyThread thread = new MyThread();
        thread.setName("飞机");
        thread.start();

        MyThread thread1 = new MyThread();
        thread1.setName("大炮");
        thread1.start();

        //返回值：当前正在执行的线程的名字
        System.out.println("线程名字"+Thread.currentThread().getName());
    }

}
